﻿using System;

namespace RL
{
    public interface IMoveable
    {
        void MoveUp();
        void MoveDown();
        void MoveLeft();
        void MoveRight();

        Point Position { get; set; }
        Point LastPosition { get; set; }
    }

    public class Moveable : IMoveable
    {
        private int _x, _y;

        public Moveable(int x, int y)
        {
            this._x = x;
            this._y = y;
        }

        public Moveable(Point startPos)
        {
            this.Position = startPos;
            this._y = 0;
        }

        Point IMoveable.Position { get; set; }
        Point IMoveable.LastPosition { get; set; }

        void IMoveable.MoveUp() { this._y -= 1; }
        void IMoveable.MoveDown() { this._y += 1; }
        void IMoveable.MoveLeft() { this._x -= 1; }
        void IMoveable.MoveRight() { this._x += 1; }
    }
}